home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / include / incl98.zoo / termios.h < prev    next >
C/C++ Source or Header  |  1994-03-29  |  3KB  |  143 lines

  1. #ifndef _TERMIOS_H
  2. #define _TERMIOS_H
  3.  
  4. #define VEOF    0
  5. #define VEOL    1
  6. #define VERASE    2
  7. #define VINTR    3
  8. #define VKILL    4
  9. #define VQUIT    5
  10. #define VSUSP    6
  11. #define VSTART    7
  12. #define VSTOP    8
  13. #define VMIN    9
  14. #define VTIME    10
  15. #define VLNEXT    11        /* <-- Not POSIX */
  16. #define VWERASE    12        /* <-- Not POSIX */
  17.  
  18. #define NCCS    (VWERASE + 1)
  19.  
  20. typedef unsigned short tcflag_t;
  21. typedef unsigned short speed_t;
  22. typedef unsigned char cc_t;
  23.  
  24. struct termios {
  25.   tcflag_t c_iflag;
  26.   tcflag_t c_oflag;
  27.   tcflag_t c_cflag;
  28.   tcflag_t c_lflag;
  29.   speed_t  _c_ispeed;
  30.   speed_t  _c_ospeed;
  31.   cc_t     c_cc[NCCS];
  32. };
  33.  
  34. /* input flags */
  35. #define BRKINT    0x0001
  36. #define IGNBRK    0x0002
  37. #define IGNPAR    0x0004
  38. #define PARMRK    0x0008
  39. #define INPCK    0x0010
  40. #define ISTRIP    0x0020
  41. #define INLCR    0x0040
  42. #define IGNCR    0x0080
  43. #define ICRNL    0x0100
  44. #define IXON    0x0200
  45. #define IXOFF    0x0400
  46.  
  47. /* output modes */
  48. #define OPOST    0x0001
  49.  
  50. /* control modes */
  51. #define CLOCAL    0x0001
  52. #define CREAD    0x0002
  53. #define CS5    0x0004
  54. #define CS6    0x0008
  55. #define CS7    0x0010
  56. #define CS8    0x0020
  57. # define CSIZE    (CS5 | CS6 | CS7 | CS8)
  58. #define CSTOPB    0x0040
  59. #define HUPCL    0x0080
  60. #define PARENB    0x0100
  61. #define PARODD    0x0200
  62.  
  63. /* local modes */
  64. #define ECHOE    0x0001
  65. #define ECHOK    0x0002
  66. #ifndef _IOCTL_H
  67. #define ECHO    0x0004
  68. #endif /* _IOCTL_H */
  69. #define ECHONL    0x0008
  70. #define ICANON    0x0010
  71. #define ISIG    0x0020
  72. #ifndef _IOCTL_H
  73. #define NOFLSH    0x0040
  74. #endif /* _IOCTL_H */
  75. #define IEXTEN    0x0080
  76. #ifndef _IOCTL_H
  77. #define TOSTOP    0x0100
  78. #endif /* _IOCTL_H */
  79.  
  80. /* actions for tcflow() */
  81. #define TCOOFF        0
  82. #define TCOON        1
  83. #define TCIOFF        2
  84. #define TCION        3
  85.  
  86. /* actions for tcflush() */
  87. #define TCIFLUSH    0
  88. #define TCOFLUSH    1
  89. #define TCIOFLUSH    3
  90.  
  91. /* actions for tcsetattr() */
  92. #define TCSANOW        0
  93. #define TCSADRAIN    1
  94. #define TCSAFLUSH    2
  95.  
  96. /* internal use only */
  97. #define _TF_STOPBITS    0x0003
  98. #define _TF_1STOP    0x0001
  99. #define _TF_15STOP    0x0002
  100. #define    _TF_2STOP    0x0003
  101. #define _TF_CHARBITS    0x000C
  102. #define _TF_8BIT    0
  103. #define _TF_7BIT    0x4
  104. #define _TF_6BIT    0x8
  105. #define _TF_5BIT    0xC
  106.  
  107. /* baud rate codes */
  108. #ifndef _IOCTL_H
  109. #define B0        0
  110. #define B50        1
  111. #define B75        2
  112. #define B110        3
  113. #define B134        4
  114. #define B135        4
  115. #define B150        5
  116. #define B200        6
  117. #define B300        7
  118. #define B600        8
  119. #define B1200        9
  120. #define B1800        10
  121. #define B2400        11
  122. #define B4800        12
  123. #define B9600        13
  124. #define B19200        14
  125. #define B38400        15
  126. #endif /* _IOCTL_H */
  127.  
  128. __EXTERN speed_t cfgetispeed    __PROTO((const struct termios *stp));
  129. __EXTERN speed_t cfgetospeed    __PROTO((const struct termios *stp));
  130. __EXTERN int    cfsetispeed    __PROTO((struct termios *stp,
  131.                         speed_t baudcode));
  132. __EXTERN int    cfsetospeed    __PROTO((struct termios *stp,
  133.                         speed_t baudcode));
  134. __EXTERN int    tcdrain        __PROTO((int fd));
  135. __EXTERN int    tcflow        __PROTO((int fd, int action));
  136. __EXTERN int    tcflush        __PROTO((int fd, int action));
  137. __EXTERN int    tcgetattr    __PROTO((int fd, struct termios *stp));
  138. __EXTERN int    tcsendbreak    __PROTO((int fd, int duration));
  139. __EXTERN int    tcsetattr    __PROTO((int fd, int action, 
  140.                         const struct termios *stp));
  141.  
  142. #endif /* _TERMIOS_H */
  143.